package com.android.porttallymansystem.logic.dao

import androidx.room.*
import com.android.porttallymansystem.logic.model.User

@Dao
interface UserDao {

    @Insert
    fun insertUser(user: User): Long

    @Delete
    fun deleteUser(user: User)

    @Query("select * from User")
    fun loadUsers(): List<User>

    @Query("select * from User where id = :id")
    fun loadUserById(id: Long): User

    @Query("select * from User where phone = :phone")
    fun loadUserByPhone(phone: String): User?

    @Query("select * from User where email = :email")
    fun loadUserByEmail(email: String): User?

    @Update
    fun updateUser(user: User)
}